package com.hz.springboot02.config;

import com.hz.springboot02.pojo.Provider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @ClassName InfoConfig
 * @Description 初始化配置
 * @Author Administrator
 * @Date 2024/12/10 15:54
 */
@Configuration
@PropertySource(value = "classpath:pro.yml",encoding = "utf-8")
@ConfigurationProperties(prefix = "pro")
public class InfoConfig {
    @Value("${proCode}")
    private String proCode;
    @Value("${proName}")
    private String proName;

    @Bean(name = "provider")
    public Provider addPro(){
        Provider provider = new Provider();
        provider.setProCode(proCode);
        provider.setProName(proName);
        return provider;
    }
}
